Conditions | 1 |
Total Lines | 7 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 4 |
CRAP Score | 1 |
Changes | 0 |
1 | import {ObserverAdapter, OnChangeCallback} from '@enbock/state-value-observer/ValueObserver'; |
||
18 | |||
19 | attach<Type>(key: string, adapter: ObserverAdapter<Type>): StorageAdapter<Type> { |
||
20 | 1 | const callback: OnChangeCallback<Type> = (newValue: Type) => this.updateStorage(key, newValue); |
|
21 | 1 | const storageAdapter: StorageAdapter<Type> = new StorageAdapter<Type>(adapter, callback); |
|
22 | 1 | this.adapters[key] = storageAdapter; |
|
23 | |||
24 | 1 | return storageAdapter; |
|
25 | } |
||
41 |